export const categoryList = [ 'life', 'zhuangzi']

export const postsList = [
  {
    category: categoryList[0],
    tag: '生活',
    alias: 'one',
    title: '庄子 逍遥游 大椿树的年轮',
    releaseDate: '2023-06-15'
  },
  {
    category: categoryList[0],
    tag: '生活',
    alias: 'two',
    title: '庖丁解牛',
    releaseDate: '2023-06-15'
  },
  {
    category: categoryList[1],
    tag: '庄子',
    alias: 'three',
    title: '庖丁解牛',
    releaseDate: '2023-06-15'
  }
]

const obj = {}

for(let i = 0; i < postsList.length; i++) {
  categoryList.forEach(item => {
    if(postsList[i].category === item) {
      obj[item] = obj[item] || []
      obj[item].push(postsList[i])
    }
  })
}

export const categoryObj = obj
